package com.fufan.mtsaas.modules.base.processinfo.controller;


import com.fufan.mtsaas.modules.common.bo.request.DataRequestT;
import com.fufan.mtsaas.modules.common.bo.request.ResultPack;
import com.fufan.mtsaas.modules.common.bo.response.RequestPojo;
import com.fufan.mtsaas.modules.common.bo.response.Result;
import com.fufan.mtsaas.modules.base.processinfo.bo.request.ProcessInfoQueryRequest;
import com.fufan.mtsaas.modules.base.processinfo.response.PProcessInfoResponse;
import com.fufan.mtsaas.modules.base.processinfo.service.PProcessInfoSvc;
import com.fufan.mtsaas.util.ParamUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 流程处理表
 * </p>
 *
 * @author Liby
 * @since 2024-12-16
 */
@Api(tags = "公共-审批流程处理", description = "审批流：流程处理接口")
@RestController
@RequestMapping("/MTSaas/ProcessInfo")
public class PProcessInfoCtrl {
    @Autowired
    private PProcessInfoSvc targetService;


    /**
     * 审批历史,分页
     */
    @ApiOperation(value = "审批历史，分页", httpMethod = "POST", produces = "application/json")
    @PostMapping(value = "/doQueryPage")
    public Result<PProcessInfoResponse> doQueryPage(@RequestBody DataRequestT<ProcessInfoQueryRequest> dataRequest) {
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        ProcessInfoQueryRequest map = dataRequest.getData().getParam();

        return resultPack.doResultPack(targetService.doQueryPage(map), requestPojo.getIntfId(), requestPojo.getAppKey());
    }

    /**
     * 审批历史,获取所有
     */
    @ApiOperation(value = "审批历史,获取所有", httpMethod = "POST", produces = "application/json")
    @PostMapping(value = "/doQueryAll")
    public Result<PProcessInfoResponse> doQueryAll(@RequestBody DataRequestT<ProcessInfoQueryRequest> dataRequest) {
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        ProcessInfoQueryRequest map = dataRequest.getData().getParam();

        return resultPack.doResultPack(targetService.doQueryAll(map), requestPojo.getIntfId(), requestPojo.getAppKey());
    }

}
